package com.zj.study.utils.validation.annotation.constraint;


import com.zj.study.utils.validation.annotation.Constraint;
import com.zj.study.utils.validation.validator.pattern.PatternValidatorForString;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 校验对象匹配正则表达式,不校验 null 值
 * <p>支持类型: {@link String}</p>
 *
 * @author 谭耀飞
 * @since 2020.12.0
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Constraint(validateBy = {
    PatternValidatorForString.class
})
public @interface Pattern {

  /**
   * @return 正则表达式
   */
  String value();

  /**
   * @return 异常信息
   */
  String message() default "";

}
